
import com.test.mabatis.dao.EmployeeMapper;
import com.test.mybatis.pojo.Employee;
import com.test.mybatis.pojo.EmployeeExample;
import dao.DeptDao;
//import dao.DeptDaoImp;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import pojo.Dept;

import java.util.List;

public class SpringTest {

    public static void main(String [] args){
        ApplicationContext applicationContext=new ClassPathXmlApplicationContext("spring.xml");
         EmployeeMapper mapper=applicationContext.getBean(EmployeeMapper.class);
        EmployeeExample example=new EmployeeExample();
        EmployeeExample.Criteria criteria=example.createCriteria();
        criteria.andNameLike("小%");
        criteria.andDeptidEqualTo(1);
        List<Employee> employees=mapper.selectByExample(example);
        for (Employee employee : employees) {
            System.out.println(employee.getName());
        }
        /* DeptDao deptDao=applicationContext.getBean(DeptDao.class);
        List<Dept> deptList=deptDao.getDeptList();
        System.out.println(deptList);
        Dept dept=deptDao.getDeptById(2);
        System.out.println(dept);*/


    }
}
